<template>
	<view class="box" v-if="order_info!=''">
		<view class="box_top">
			<view>下单时间：{{order_info.add_datetime}}</view>
			<view v-if="Number(order_info.payment_datetime)">购买时间：{{order_info.payment_datetime}}</view>
			<!-- <view v-if="order_info.close_info">取消时间：{{order_info.close_info.log_time |formaDate}}</view> -->
			<view>订单编号：{{order_info.order_sn||""}}</view>
			<view v-if="order_info.order_confirm_day">自动收货时间：{{order_info.order_confirm_day||""}}</view>
		</view>
		<view class="border"></view>
		<view class="shop_box" v-for="item in order_info.goods_list" :key="item.goods_id" @click="goInfo(item.goods_id)">
			<image :src="item.goods_image_url" mode=""></image>
			<image v-if="item.status==0" class="cartShelf" :src="`${picUrl}/xiajia.png`"></image>
			<view style="width: 400rpx;">
				<view class="ellipsis" style="font-size: 26rpx;">{{item.goods_name}}</view>
				<view class="f24 cb4">
				{{item.goods_spec_name}} x{{item.goods_num}}
				<text v-if="item.goods_type==2" class="zengpin">抢购</text>
				<text v-if="item.goods_type==3" class="zengpin">限时折扣</text>
				<text v-if="item.goods_type==4" class="zengpin">组合套装</text>
				<text v-if="item.goods_type==5" class="zengpin">赠品</text>
				<text v-if="item.goods_type==6" class="zengpin">秒杀</text>
				<text v-if="item.goods_type==7" class="zengpin">拼团</text>
				<text v-if="item.goods_type==8" class="zengpin">砍价</text>
				<text v-if="item.goods_type==9" class="zengpin">特价</text>
				<text v-if="item.goods_type==10" class="zengpin">直降</text>
				<text v-if="item.goods_type==11" class="zengpin">加价购</text>
				<text v-if="item.goods_type==12" class="zengpin">换购</text>
				<text v-if="item.goods_type==15" class="zengpin">预售</text>
				<text v-if="item.goods_type==16" class="zengpin">员购</text>
				</view>
				<view class="f24 cf4">¥{{item.goods_price||""}}</view>
				
			</view>
			<view class="order_stauts">{{order_info.order_state_txt||""}}</view>
		</view>
		<!-- <view class="border"></view> -->
		<view class="item_title">优惠信息</view>
		<view class="pad">
			<view class="flex">
				<view class="left_width">商品价格：</view>
				<view class="cf4">¥{{order_info.goods_s_price ||""}}</view>
			</view>
			
			<view class="flex" v-if="Number(order_info.shareOffer)">
				<view class="left_width">促销活动：</view>
				<view class="cf4">-¥{{order_info.shareOffer||""}}</view>
			</view>
			<view class="flex" v-if="Number(order_info.extend_info.order_pointscount)">
				<view class="left_width">积分：</view>
				<view class="cf4">-¥{{order_info.extend_info.order_pointscount||""}}</view>
			</view>
			<view class="flex" v-if="Number(order_info.vip_discount_amount)">
				<view class="left_width">会员折扣：</view>
				<view class="cf4">-¥{{order_info.vip_discount_amount ||""}}</view>
			</view>
			<view class="flex" v-if="Number(order_info.extend_info.voucher_price)">
				<view class="left_width">代金券：</view>
				<view class="cf4">-¥{{order_info.extend_info.voucher_price ||""}}</view>
			</view>
			<view class="flex" v-if="Number(order_info.extend_info.platform_points_offset_amount)">
				<view class="left_width">积分抵扣：</view>
				<view class="cf4">-¥{{order_info.extend_info.platform_points_offset_amount ||""}}</view>
			</view>
			<view class="flex">
				<view class="left_width">运费：</view>
				<view class="cf4">¥{{order_info.shipping_fee||""}}</view>
			</view>
			<view class="flex">
				<view class="left_width">实付款：</view>
				<view class="cf4">¥{{order_info.if_payment?'0.00':order_info.order_amount}}</view>
			</view>	
			
			
		</view>
		<view class="item_title">收货人信息</view>
		<view class="pad" >
			<view>收货人：{{order_info.reciver_name||""}}</view>
			<view >联系方式：{{order_info.reciver_mobile}}</view>
			<view>收货地址：{{order_info.reciver_address}}</view>
			<view>买家留言：{{order_info.extend_info.order_message||""}}</view>
		</view>
		<view class="item_title" v-if="order_info.if_deliver">商家发货信息</view>
		<view class="pad" v-if="order_info.if_deliver">
			<view>商家发货人：{{daddress_info.seller_name||""}}</view>
			<view >商家联系方式：{{daddress_info.telphone||""}}</view>
			<view>商家发货地址：{{daddress_info.area_info||""}}{{daddress_info.address||""}}</view>
			<view>商家留言：{{daddress_info.company||""}}</view>
		</view>
		<view class="item_title">商家信息</view>
		<view class="pad" >
			<view>店铺名称：{{order_info.store_name||""}}</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				order_id:'',
				order_info:"",
				daddress_info:''
			}
		},
		onLoad(e) {
			this.order_id=e.order_id
			this.getOrderInfo()
		},
		methods:{
			getOrderInfo(){
				this.$util.request({
					url:'/mobile/index.php?act=member_order&op=show_order',
					data:{
						order_id:this.order_id
					}
				}).then(res=>{
					this.order_info=res.datas.order_info
					this.daddress_info=res.datas.daddress_info
				})
			},
			//跳转到详情页面
			goInfo(goods_id) {
				uni.navigateTo({
					url: '/mall/goods/info?goods_id=' + goods_id,
				})
			},
		}
	}
</script>

<style>
	.zengpin{
		padding: 2rpx 15rpx;
		border-radius: 5px;
		color: #ffffff;
		background-color:#ff4300;
		font-size: 26rpx;
		margin-left: 20rpx;
		
	}
	.box{
		background-color: #FFFFFF;border-top: 1rpx solid #F0F0F0;
	}
	.box_top{
		padding: 20rpx 28rpx;color: #b4b4b4;font-size: 26rpx;
	}
	.order_stauts{
		color: #FF4444;font-size: 26rpx;font-weight: bold;
	}
	.item_title{
		background-color: #F0F0F0;padding: 10rpx 28rpx;
	}
	.shop_box{
		padding:20rpx 28rpx;display: flex;justify-content: space-between;
		position: relative;
	}
	.shop_box image:nth-child(1){
		width: 165rpx;height: 178rpx;margin-right: 20rpx;
		
	}
	.cartShelf {
		width: 166rpx;
		height: 50rpx;
		// border-radius: 10rpx;
		position: absolute;
		top: 151rpx;
		left: 28rpx;
		z-index: 2;
		// background: rgba(0,0,0,.3);
	}
	uni-page-body{
		/* background-color: #FFFFFF; */
	}
	.pad{
		padding: 20rpx 28rpx;
	}
	.pad view{
		margin: 4rpx 0;
	}
	.f24{
		font-size: 24rpx;
	}
	.cb4{
		color: #b4b4b4
	}
	.cf4{
		color: #FF4444;
	}
	.left_width{
		width: 140rpx;
	}
	.flex{
		display: flex;
	}
	.border{
		border: 10rpx solid #F0F0F0;
	}
	.ellipsis{
		overflow: hidden;
		display: -webkit-box; 
		-webkit-line-clamp: 2; 
		-webkit-box-orient: vertical;
		text-overflow: ellipsis;
	}
</style>
